<template>
  <div class="custom-form">
    <el-row :gutter="15">
      <el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="100px"
        :key="showFormKey">
        <!-- 用印申请 -->
        <el-col :span="24">
          <el-form-item label-width="0">
            <h2 align='center' style="color:undefined;font-size: nullpx;text-align: center">用印申请</h2>
          </el-form-item>
        </el-col>
        <!-- 申请人ID -->
        <el-col :span="24" v-show="showFlag">
          <el-form-item :label="$t('申请人ID')" prop="F_UserId">
              <el-input v-model="formData['F_UserId']" placeholder="请输入申请人名称"
              :disabled="hasDisabledPermission('F_UserId',false)"
              :readonly="!hasEditPermission('F_UserId',false)" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 申请人名称 -->
        <el-col :span="24" >
          <el-form-item :label="$t('申请人名称')" prop="F_UserName">
            <el-input v-model="formData['F_UserName']" placeholder="请输入申请人名称"
              :disabled="hasDisabledPermission('F_UserName',false)"
              :readonly="true" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 申请时间 -->
        <el-col :span="24" v-show="showFlag">
          <el-form-item :label="$t('申请时间')" prop="F_ApplyTime">
            <el-input v-model="formData['F_ApplyTime']" placeholder="请输入申请时间"
              :disabled="hasDisabledPermission('F_ApplyTime',false)"
              :readonly="!hasEditPermission('F_ApplyTime',false)" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 职级名称 -->
        <el-col :span="24" v-show="showFlag">
          <el-form-item :label="$t('职级名称')" prop="F_Job">
            <el-input v-model="formData['F_Job']" placeholder="请输入职级名称"
              :disabled="hasDisabledPermission('F_Job',false)"
              :readonly="!hasEditPermission('F_Job',false)" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 部门名称 -->
        <el-col :span="24" v-show="showFlag">
          <el-form-item :label="$t('部门名称')" prop="F_DepartmentName">
            <el-input v-model="formData['F_DepartmentName']" placeholder="请输入部门名称"
              :disabled="hasDisabledPermission('F_DepartmentName',false)"
              :readonly="!hasEditPermission('F_DepartmentName',false)" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 部门ID -->
        <el-col :span="24" >
          <el-form-item :label="$t('部门')" prop="F_Department">
              <el-select
                v-model="formData['F_Department']"
                placeholder="请选择部门"
                :style="{ width: '100%' }"
                @change="Handleselect"
              >

            <el-option
              v-for="(item, index) in F_DepartmentData"
              :key="index"
              :label="item.F_FullName"
              :value="item.F_DepartmentId"
            ></el-option>

            </el-select>
          </el-form-item>
        </el-col>
        <!-- 角色ID -->
        <el-col :span="24" v-show="showFlag">
          <el-form-item :label="$t('角色ID')" prop="F_RoleId">
            <el-input v-model="formData['F_RoleId']" placeholder="请输入角色ID"
              :disabled="hasDisabledPermission('F_RoleId',false)"
              :readonly="!hasEditPermission('F_RoleId',false)" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 角色名称 -->
        <el-col :span="24" v-show="showFlag">
          <el-form-item :label="$t('角色名称')" prop="F_RoleName">
            <el-input v-model="formData['F_RoleName']" placeholder="请输入角色名称"
              :disabled="hasDisabledPermission('F_RoleName',false)"
              :readonly="!hasEditPermission('F_RoleName',false)" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 地区 -->
        <el-col :span="24" v-show="showFlag">
          <el-form-item :label="$t('地区')" prop="F_Area">
            <el-input v-model="formData['F_Area']" placeholder="请输入地区"
              :disabled="hasDisabledPermission('F_Area',false)"
              :readonly="!hasEditPermission('F_Area',false)" clearable :style="{width: '100%'}"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="24" >
          <el-form-item :label="$t('经办人')" prop="F_TransactorName">
            <el-input v-model="formData['F_TransactorName']" placeholder="请输入经办人"
              :disabled="hasDisabledPermission('F_TransactorName',false)"
              :readonly="!hasEditPermission('F_TransactorName',false)" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 日期 -->
        <el-col :span="24" >
          <el-form-item :label="$t('日期')" prop="F_TransactionTime">
            <el-date-picker :disabled="hasDisabledPermission('F_TransactionTime',false)"
              :readonly="!hasEditPermission('F_TransactionTime',false)"
              v-model="formData['F_TransactionTime']" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
              :style="{width: '100%'}" placeholder="请选择日期" clearable></el-date-picker>
          </el-form-item>
        </el-col>
        <!-- 是否借出 -->
        <el-col :span="24" >
          <el-form-item :label="$t('是否借出')" prop="F_isLoan">
            <el-select v-model="formData['F_isLoan']" placeholder="请选择是否借出"
              :disabled="hasDisabledPermission('F_isLoan',false)" filterable clearable
              @change="selectJIECHU"
              :style="{width: '100%'}">
              <el-option v-for="(item, index) in F_isloanOptions" :key="index" :label="item.F_ItemName"
                :value="item.F_ItemValue" :disabled="item.disabled"></el-option>
            </el-select>
          </el-form-item>
        </el-col>

        <!-- 印章公司选择 -->
        <el-col :span="24" v-show="fouFlag">
          <el-form-item :label="$t('印章公司选择')" prop="F_SealCompany">
            <el-select v-model="formData['F_SealCompany']" placeholder="请选择印章公司选择"
              :disabled="hasDisabledPermission('F_SealCompany',false)" filterable clearable
              :style="{width: '100%'}">
              <el-option v-for="(item, index) in seal_companyOptions" :key="index" :label="item.F_ItemName"
                :value="item.F_ItemValue" :disabled="item.disabled"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <!-- 印章类型 -->
        <el-col :span="24" v-show="fouFlag">
          <el-form-item :label="$t('印章类型')" prop="F_SealType">
            <el-select v-model="formData['F_SealType']" placeholder="请选择印章类型"
              :disabled="hasDisabledPermission('F_SealType',false)" filterable clearable
              :style="{width: '100%'}">
              <el-option v-for="(item, index) in seal_typeOptions" :key="index" :label="item.F_ItemName"
                :value="item.F_ItemValue" :disabled="item.disabled"></el-option>
            </el-select>
          </el-form-item>
        </el-col>

        <!-- 印章公司选择(借出) -->
        <el-col :span="24" v-show="shiFlag">
          <el-form-item :label="$t('印章公司选择(借出)')" prop="F_LoanSealCompany">
            <el-select v-model="formData['F_LoanSealCompany']" placeholder="请选择印章公司选择(借出)"
              :disabled="hasDisabledPermission('F_LoanSealCompany',false)" filterable clearable
              :style="{width: '100%'}">
              <el-option v-for="(item, index) in loan_seal_companyOptions" :key="index"
                :label="item.F_ItemName" :value="item.F_ItemValue" :disabled="item.disabled"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <!-- 事由 -->
        <el-col :span="24" v-show="shiFlag">
          <el-form-item :label="$t('事由')" prop="F_Reasons">
            <el-input v-model="formData['F_Reasons']" placeholder="请输入事由"
              :disabled="hasDisabledPermission('F_Reasons',false)"
              :readonly="!hasEditPermission('F_Reasons',false)" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 借出时间 -->
        <el-col :span="24" v-show="shiFlag">
          <el-form-item :label="$t('借出时间')" prop="F_OutTime">
            <el-date-picker :disabled="hasDisabledPermission('F_OutTime',false)"
              :readonly="!hasEditPermission('F_OutTime',false)" v-model="formData['F_OutTime']"
              format="yyyy-MM-dd" value-format="yyyy-MM-dd" :style="{width: '100%'}" placeholder="请选择借出时间"
              clearable></el-date-picker>
          </el-form-item>
        </el-col>
        <!-- 预计归还时间 -->
        <el-col :span="24" v-show="shiFlag">
          <el-form-item :label="$t('预计归还时间')" prop="F_ReturnTime">
            <el-date-picker :disabled="hasDisabledPermission('F_ReturnTime',false)"
              :readonly="!hasEditPermission('F_ReturnTime',false)" v-model="formData['F_ReturnTime']"
              format="yyyy-MM-dd" value-format="yyyy-MM-dd" :style="{width: '100%'}" placeholder="请选择预计归还时间"
              clearable></el-date-picker>
          </el-form-item>
        </el-col>
        <!-- 借出事由 -->
        <el-col :span="24" v-show="shiFlag">
          <el-form-item :label="$t('借出事由')" prop="F_ReasonType">
            <el-select v-model="formData['F_ReasonType']" placeholder="请选择借出事由"
              :disabled="hasDisabledPermission('F_ReasonType',false)" filterable clearable
              :style="{width: '100%'}">
              <el-option v-for="(item, index) in reason_typeOptions" :key="index" :label="item.F_ItemName"
                :value="item.F_ItemValue" :disabled="item.disabled"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <!-- 备注 -->
        <el-col :span="24" >
          <el-form-item :label="$t('备注')" prop="F_Remark">
            <el-input v-model="formData['F_Remark']" type="textarea" placeholder="请输入备注"
              :disabled="hasDisabledPermission('F_Remark',false)"
              :readonly="!hasEditPermission('F_Remark',false)" :autosize="{minRows: 4, maxRows: 4}"
              :style="{width: '100%'}"></el-input>
          </el-form-item>
        </el-col>
        <!-- 是否生效 -->
        <el-col :span="24" v-show="showFlag">
          <el-form-item :label="$t('是否生效')" prop="F_IsEffective">
            <el-input v-model="formData['F_IsEffective']" placeholder="请输入是否生效"
              :disabled="hasDisabledPermission('F_IsEffective',false)"
              :readonly="!hasEditPermission('F_IsEffective',false)" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 意见簿 -->
        <el-col :span="24" v-show="optionsFlag">
          <el-form-item :label="$t('意见簿')" prop="field125dbe0">
            <xjr-opinion-comonent :value="formData.field125dbe0"></xjr-opinion-comonent>
          </el-form-item>
        </el-col>
        <!-- 按钮 -->
        <el-col :span="24" v-if="!isWorkflowForm">
          <el-form-item size="large" v-if="isEdit">
            <el-button type="primary" @click="submitForm" :loading="submitLoading">
              {{submitLoading?$t('workFlow.WFMenu.hintSubmit'):$t('submit')}}</el-button>
            <el-button @click="cancelForm">{{$t('cancelText')}}</el-button>
          </el-form-item>
        </el-col>
      </el-form>
    </el-row>
  </div>
</template>
<script>

  import FilterableDataList from '@/components/generator/clientComponents/FilterableDataList.vue';
  import workflowFormAuthorize from "@/mixins/workflowFormAuthorize";
  import authorizeMixin from "@/mixins/authorize";
  import { baseUrl } from "@/config/env";
  import request from "@/router/axios";
  import {getUserDetailsById,getGroupDetails} from '@/api/user.js';
  export default {
    mixins: [authorizeMixin,workflowFormAuthorize],
  components: {},
  props: ['keyValue', 'isEdit', 'disabled'],
  data() {
    let _this = this
    return {
      submitLoading: false,
      showForm: true,
      showFormKey: 1,
      reRenderSubform: false,
      operationVal: 'add',
      isAdd: true,
      addressUrl:'apply_seal',
      mainTableName: 'apply_seal',
      formConfig: {},
      formData: {
        'F_UserId': '',
        'F_UserName': '',
        'F_ApplyTime': '2022-12-28',
        'F_Job': '',
        'F_Department': '',
        'F_DepartmentName': '',
        'F_RoleId': '',
        'F_RoleName': '',
        'F_Area': '',
        // 'F_TransactorId': '',
        'F_TransactorName': '',
        'F_TransactionTime': null,
        'F_isLoan': '',
        'F_SealCompany': '',
        'F_SealType': '',
        'F_LoanSealCompany': '',
        'F_Reasons': '',
        'F_OutTime': null,
        'F_ReturnTime': null,
        'F_ReasonType': '',
        'F_Remark': '',
        'F_IsEffective': '0',
        'field125dbe0': null,
      },
      rules: {
        F_UserId: [],
        F_UserName: [{
          required: true,
          message: '请输入申请人名称',
          trigger: 'blur'
        }],
        F_ApplyTime: [{
          required: false,
          message: '请输入申请时间',
          trigger: 'blur'
        }],
        F_Job: [{
          required: true,
          message: '请输入职级ID',
          trigger: 'blur'
        }],
        F_Job: [{
          required: true,
          message: '请输入职级名称',
          trigger: 'blur'
        }],
        F_Department: [],
        F_DepartmentName: [{
          required: true,
          message: '请输入部门名称',
          trigger: 'blur'
        }],
        F_RoleId: [{
          required: true,
          message: '请输入角色ID',
          trigger: 'blur'
        }],
        F_RoleName: [{
          required: true,
          message: '请输入角色名称',
          trigger: 'blur'
        }],
        F_Area: [{
          required: true,
          message: '请输入地区',
          trigger: 'blur'
        }],
        // F_TransactorId: [],
        F_TransactorName: [{
          required: true,
          message: '请输入经办人',
          trigger: 'blur'
        }],
        F_TransactionTime: [{
          required: true,
          message: '请选择日期',
          trigger: 'change'
        }],
        F_isLoan: [{
          required: true,
          message: '请选择是否借出',
          trigger: 'change'
        }],
        F_SealCompany: [{
          required: false,
          message: '请选择印章公司选择',
          trigger: 'change'
        }],
        F_SealType: [{
          required: false,
          message: '请选择印章类型',
          trigger: 'change'
        }],
        F_LoanSealCompany: [{
          required: false,
          message: '请选择印章公司选择(借出)',
          trigger: 'change'
        }],
        F_Reasons: [{
          required: false,
          message: '请输入事由',
          trigger: 'blur'
        }],
        F_OutTime: [{
          required: false,
          message: '请选择借出时间',
          trigger: 'change'
        }],
        F_ReturnTime: [{
          required: false,
          message: '请选择预计归还时间',
          trigger: 'change'
        }],
        F_ReasonType: [{
          required: false,
          message: '请选择借出事由',
          trigger: 'change'
        }],
        F_Remark: [],
        F_IsEffective: [],
      },
      user_idOptions: undefined,
      dept_idOptions: undefined,
      transactor_idOptions: undefined,
      F_isloanOptions: [],
      seal_companyOptions: [],
      seal_typeOptions: [],
      loan_seal_companyOptions: [],
      reason_typeOptions: [],
      shiFlag:false,
      fouFlag:false,
      F_DepartmentData:[],
      F_RoleData:[],
      showFlag:false

    }
  },
  computed: {},
  watch: {},
  created() {
    this.formConfig = this.getFormConfig();
  },
  async mounted() {
    //TODO   再这里做数据回填 请求表单数据
    if(this.keyValue){
        this.isAdd = false;
    }
    if(!this.isAdd&&this.keyValue){
      this.operationVal = 'edit';
      try {
        let res = await request({
          url: baseUrl + "/"+this.addressUrl+"/" + this.keyValue,
          method: "get",
        });
        this.formData = res.data.data
        this.showFormKey++;
      } catch (error) {}
    }
    if (typeof this.getDept_idOptions == "function") {
      await this.getDept_idOptions();
    }
    if (typeof this.getF_isloanOptions == "function") {
      await this.getF_isloanOptions();
    }
    if (typeof this.getSeal_companyOptions == "function") {
      await this.getSeal_companyOptions();
    }
    if (typeof this.getSeal_typeOptions == "function") {
      await this.getSeal_typeOptions();
    }
    if (typeof this.getLoan_seal_companyOptions == "function") {
      await this.getLoan_seal_companyOptions();
    }
    if (typeof this.getReason_typeOptions == "function") {
      await this.getReason_typeOptions();
    }

    //获取用户详情
   
   await this.getCurrentInfo()
   await this.ininOther()
  },
  methods: {
    ininOther(){
      if(this.formData.F_isLoan == '1'){
        this.shiFlag = true
        this.fouFlag = false
      }else if(this.formData.F_isLoan == '0'){
        this.shiFlag = false
        this.fouFlag = true
      }else{
        this.shiFlag = false
        this.fouFlag = false
      }
    },
    selectJIECHU(){
      if(this.formData['F_isLoan'] == '0'){
        this.shiFlag = false
        this.fouFlag = true
      }else if(this.formData['F_isLoan'] == '1'){
        this.shiFlag = true
        this.fouFlag = false
      }else{
        this.shiFlag = false
        this.fouFlag = false
      }
      
    },
    getCurrentInfo(){
      let params
      if(this.formData.F_UserId){
        params = {
          userId:this.formData.F_UserId
        }
      }else{
        params = {
          userId:this.$store.state.user.userInfo.F_UserId
        }
      }
      getUserDetailsById(params).then(res => {
        if(res.data.success){
          this.F_DepartmentData = res.data.data.F_Department
          this.F_RoleData = res.data.data.F_Role
          this.F_SchedualGroup = res.data.data.schedualGroup
          //赋值申请人信息
          this.formData['F_UserName'] =  res.data.data.F_RealName
          this.formData['F_UserId'] =  res.data.data.F_UserId
          this.formData['F_Area'] = res.data.data.F_Area
          this.formData['F_Job'] = res.data.data.F_Job
          this.initRoleData()
          this.initDepartmentData()
        }
      })
    },
        initDepartmentData(){
        if(this.F_DepartmentData && this.F_DepartmentData.length == 1){
          this.formData['F_DepartmentName'] = this.F_DepartmentData[0].F_FullName
          this.formData['F_Department'] = this.F_DepartmentData[0].F_DepartmentId
        }
      },
    initRoleData(){
      let roleId = []
      let roleName = []
      if(this.F_RoleData && this.F_RoleData.length > 0){
        this.F_RoleData.forEach(e => {
          roleId.push(e.F_RoleId)
          roleName.push(e.F_FullName)
        })
      }
      this.formData['F_RoleId'] = roleId.join(',')
      this.formData['F_RoleName'] = roleName.join(',')
      if(this.F_SchedualGroup){
        this.formData['F_AttendanceGroupName'] = this.F_SchedualGroup.schedualGroupName
        getGroupDetails(this.F_SchedualGroup.id).then(res => {
          if(res.data.success){
           this.formData['F_AttendanceGroupMaster'] = res.data.data.manageUser.realName
          }
        })
      }

    },
     Handleselect(){
      if(this.F_DepartmentData && this.F_DepartmentData.length > 0){
        this.F_DepartmentData.forEach(e => {
          if(e.F_DepartmentId == this.formData['F_Department']){
            this.formData['F_DepartmentName'] = e.F_ShortName
          }
        })
      }
    },
    getFormData() {
      let key = this.mainTableName + 'Entity';
      let returnParams = {};
      returnParams[key] = this.formData;
      return {
        ...returnParams,
      };
    },
    validateForm() {
      this.$refs['elForm'].validate(valid => {});
    },
    async aysncValidateForm() {
      let validataArry = []
      validataArry.push(new Promise((resolve, reject) => {
        this.$refs['elForm'].validate(valid => {
          resolve(valid)
        })
      }))
      let res = await Promise.all(validataArry)
      if (res.includes(false)) {
        return false
      }
      else {
        return true;
      }
    },
    changeTableData() {},
    async submitForm() {
      this.submitLoading = true;
      let valid = await this.aysncValidateForm();
      if (valid == false) {
        this.submitLoading = false;
        return false;
      }
      this.changeTableData();
      //格式化数据
      let newObj = this.getFormData();
      
        //如果没有传入参数就是新增
        if (!this.keyValue) {

          request({
            url: baseUrl + "/"+this.addressUrl,
            method: "post",
            data : newObj
          }).then((res) => {
            this.submitLoading = false;
            this.$notify({
              title: "成功",
              message: "新增成功",
              type: "success",
            });
             this.$emit("onChange",true)
          });

        }
        else{

         request({
            url: baseUrl + "/"+this.addressUrl+"/" + this.keyValue,
            method: "put",
            data : newObj
          }).then((res) => {
            this.submitLoading = false;
            this.$notify({
              title: "成功",
              message: "修改成功",
              type: "success",
            });
             this.$emit("onChange",true)
          });

        }
       
       
      
    },
    cancelForm() {
      this.$emit("onChange", true)
    },
    formatTree(data, valueField, lableField, childField, type) {
      let tree = [];
      data.forEach((node, index) => {
        let newNode = {
          value: node[valueField],
          label: node[lableField],
        };
        if (type) {
          newNode.disabled = node[valueField] == undefined ? true : false
        }
        tree.push(newNode);
        if (node[childField] != null && node[childField].length > 0) {
          newNode.children = (this.formatTree(node[childField], valueField, lableField, childField,
          type));
        }
      }, this);
      return tree;
    },
    
    //辅助工作流 审批(编辑) 预留方法
    handleEdit() {
    },
          
    async getDept_idOptions() {
      // 注意：this.$axios是通过Vue.prototype.$axios = axios挂载产生的
      try {
        let resp = await this.$axios({
          method: 'get',
          url:  baseUrl + '/companies/departments/tree',
        });
        if (resp.data) {
          let {
            data
          } = resp.data
          this.dept_idOptions = this.formatTree(data, 'F_DepartmentId', 'F_FullName', 'children', 1);
        }
      }
      catch (error) {}
    },
    async getF_isloanOptions() {
      // 注意：this.$axios是通过Vue.prototype.$axios = axios挂载产生的
      try {
        let resp = await this.$axios({
          method: 'get',
          url:  baseUrl + '/data-items/10020/detail',
        });
        if (resp.data.data) {
          this.F_isloanOptions = resp.data.data;
        }
      }
      catch (error) {}
    },
    async getSeal_companyOptions() {
      // 注意：this.$axios是通过Vue.prototype.$axios = axios挂载产生的
      try {
        let resp = await this.$axios({
          method: 'get',
          url:  baseUrl + '/data-items/stamp_company/detail',
        });
        if (resp.data.data) {
          this.seal_companyOptions = resp.data.data;
        }
      }
      catch (error) {}
    },
    async getSeal_typeOptions() {
      // 注意：this.$axios是通过Vue.prototype.$axios = axios挂载产生的
      try {
        let resp = await this.$axios({
          method: 'get',
          url:  baseUrl + '/data-items/type_seal/detail',
        });
        if (resp.data.data) {
          this.seal_typeOptions = resp.data.data;
        }
      }
      catch (error) {}
    },
    async getLoan_seal_companyOptions() {
      // 注意：this.$axios是通过Vue.prototype.$axios = axios挂载产生的
      try {
        let resp = await this.$axios({
          method: 'get',
          url:  baseUrl + '/data-items/stamp_company/detail',
        });
        if (resp.data.data) {
          this.loan_seal_companyOptions = resp.data.data;
        }
      }
      catch (error) {}
    },
    async getReason_typeOptions() {
      // 注意：this.$axios是通过Vue.prototype.$axios = axios挂载产生的
      try {
        let resp = await this.$axios({
          method: 'get',
          url:  baseUrl + '/data-items/lend_reason/detail',
        });
        if (resp.data.data) {
          this.reason_typeOptions = resp.data.data;
        }
      }
      catch (error) {}
    },
    //子表单权限
    getAuthorityTableChildrenList(bindTable, children) {
      let column = [];
      if (bindTable && this.formEnCodeList && this.formEnCodeList[bindTable]) {
        let formSubEnCodeList = this.formEnCodeList[bindTable];
        if (children && children.length > 0) {
          column = children.map(ele2 => {
            if (formSubEnCodeList.includes(ele2.prop)) {
              ele2.hide = false;
            }
            else {
              ele2.hide = true;
            }
            if (ele2.hide == false) {
              //工作流中系统表单必填权限
              if (this.formSubTableNotRequiredList[bindTable] != undefined) {
                if (this.formSubTableNotRequiredList[bindTable].includes(ele2.prop)) {
                  ele2.required = false;
                }
                else {
                  ele2.required = true;
                }
              }
              ele2.rules = [];
              if (ele2.required) {
                ele2.rules = ele2.ruleList;
              }
              // disabled 属性
              if (this.formSubTableDisabledList[bindTable] != undefined) {
                if (this.formSubTableDisabledList[bindTable].includes(ele2.prop)) {
                  ele2.disabled = true;
                }
                else {
                  ele2.disabled = false;
                }
              }
            }
            return ele2;
          });
        }
        return column;
      }
      else {
        return children;
      }
    },
    getFormConfig() {
      let config = {
        "fields": [{
          "__vModel__": "F_UserId",
          "__type__": "user",
          "__organize__": true,
          "suffix-icon": "el-icon-setting",
          "__config__": {
            "label": "申请人ID",
            "showLabel": true,
            "tag": "xjr-select-user",
            "saveValue": "",
            "required": false,
            "span": 24,
            "bindTableField": "F_UserId",
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 102,
            "fieldLength": "50",
            "bindTable": "apply_seal",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "F_UserName",
          "__config__": {
            "label": "申请人名称",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 103,
            "fieldLength": "100",
            "bindTable": "apply_seal",
            "bindTableField": "F_UserName",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "F_ApplyTime",
          "__config__": {
            "label": "申请时间",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 104,
            "fieldLength": "",
            "bindTable": "apply_seal",
            "bindTableField": "F_ApplyTime",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "F_Job",
          "__config__": {
            "label": "职级ID",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 105,
            "fieldLength": "50",
            "bindTable": "apply_seal",
            "bindTableField": "F_Job",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "F_Job",
          "__config__": {
            "label": "职级名称",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 106,
            "fieldLength": "100",
            "bindTable": "apply_seal",
            "bindTableField": "F_Job",
            "bindTableFieldType": "varchar"
          }
        }, {
          "tempType": "tree",
          "__vModel__": "F_Department",
          "__type__": "department",
          "__organize__": true,
          "__config__": {
            "label": "部门ID",
            "showLabel": true,
            "required": false,
            "tag": "avue-input-tree",
            "dataKey": "data",
            "span": 24,
            "bindTableField": "F_Department",
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 107,
            "fieldLength": "50",
            "bindTable": "apply_seal",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "F_DepartmentName",
          "__config__": {
            "label": "部门名称",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 108,
            "fieldLength": "100",
            "bindTable": "apply_seal",
            "bindTableField": "F_DepartmentName",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "F_RoleId",
          "__config__": {
            "label": "角色ID",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 109,
            "fieldLength": "50",
            "bindTable": "apply_seal",
            "bindTableField": "F_RoleId",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "F_RoleName",
          "__config__": {
            "label": "角色名称",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 110,
            "fieldLength": "100",
            "bindTable": "apply_seal",
            "bindTableField": "F_RoleName",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "F_Area",
          "__config__": {
            "label": "地区",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 111,
            "fieldLength": "255",
            "bindTable": "apply_seal",
            "bindTableField": "F_Area",
            "bindTableFieldType": "varchar"
          }
        }, 
        // {
        //   "__vModel__": "F_TransactorId",
        //   "__type__": "user",
        //   "__organize__": true,
        //   "suffix-icon": "el-icon-setting",
        //   "__config__": {
        //     "label": "经办人ID",
        //     "showLabel": true,
        //     "tag": "xjr-select-user",
        //     "saveValue": "",
        //     "required": false,
        //     "span": 24,
        //     "bindTableField": "F_TransactorId",
        //     "F_LgMarkCode": "",
        //     "prestrainField": "",
        //     "formId": 112,
        //     "fieldLength": "50",
        //     "bindTable": "apply_seal",
        //     "bindTableFieldType": "varchar"
        //   }
        // },
         {
          "__vModel__": "F_TransactorName",
          "__config__": {
            "label": "经办人",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 113,
            "fieldLength": "100",
            "bindTable": "apply_seal",
            "bindTableField": "F_TransactorName",
            "bindTableFieldType": "varchar"
          }
        }, {
          "tempType": "date",
          "__vModel__": "F_TransactionTime",
          "__config__": {
            "label": "日期",
            "tag": "el-date-picker",
            "avueType": "datetime",
            "defaultValue": null,
            "showLabel": true,
            "span": 24,
            "required": true,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 114,
            "fieldLength": "",
            "bindTableFieldType": "datetime",
            "bindTable": "apply_seal",
            "bindTableField": "F_TransactionTime"
          }
        }, {
          "__vModel__": "F_isLoan",
          "__config__": {
            "label": "是否借出",
            "showLabel": true,
            "tag": "el-select",
            "avueType": "select",
            "span": 24,
            "required": true,
            "saveField": "",
            "showField": "",
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 115,
            "dataType": "dataItem",
            "dataItem": "10020",
            "fieldLength": "10",
            "bindTable": "apply_seal",
            "bindTableField": "F_isLoan",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "F_SealCompany",
          "__config__": {
            "label": "印章公司选择",
            "showLabel": true,
            "tag": "el-select",
            "avueType": "select",
            "span": 24,
            "required": true,
            "saveField": "",
            "showField": "",
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 116,
            "dataType": "dataItem",
            "dataItem": "stamp_company",
            "fieldLength": "255",
            "bindTable": "apply_seal",
            "bindTableField": "F_SealCompany",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "F_SealType",
          "__config__": {
            "label": "印章类型",
            "showLabel": true,
            "tag": "el-select",
            "avueType": "select",
            "span": 24,
            "required": true,
            "saveField": "",
            "showField": "",
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 117,
            "dataType": "dataItem",
            "dataItem": "type_seal",
            "fieldLength": "50",
            "bindTable": "apply_seal",
            "bindTableField": "F_SealType",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "F_LoanSealCompany",
          "__config__": {
            "label": "印章公司选择(借出)",
            "showLabel": true,
            "tag": "el-select",
            "avueType": "select",
            "span": 24,
            "required": true,
            "saveField": "",
            "showField": "",
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 118,
            "dataType": "dataItem",
            "dataItem": "stamp_company",
            "fieldLength": "255",
            "bindTable": "apply_seal",
            "bindTableField": "F_LoanSealCompany",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "F_Reasons",
          "__config__": {
            "label": "事由",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 119,
            "fieldLength": "500",
            "bindTable": "apply_seal",
            "bindTableField": "F_Reasons",
            "bindTableFieldType": "varchar"
          }
        }, {
          "tempType": "date",
          "__vModel__": "F_OutTime",
          "__config__": {
            "label": "借出时间",
            "tag": "el-date-picker",
            "avueType": "datetime",
            "defaultValue": null,
            "showLabel": true,
            "span": 24,
            "required": true,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 120,
            "fieldLength": "",
            "bindTableFieldType": "datetime",
            "bindTable": "apply_seal",
            "bindTableField": "F_OutTime"
          }
        }, {
          "tempType": "date",
          "__vModel__": "F_ReturnTime",
          "__config__": {
            "label": "预计归还时间",
            "tag": "el-date-picker",
            "avueType": "datetime",
            "defaultValue": null,
            "showLabel": true,
            "span": 24,
            "required": true,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 121,
            "fieldLength": "",
            "bindTableFieldType": "datetime",
            "bindTable": "apply_seal",
            "bindTableField": "F_ReturnTime"
          }
        }, {
          "__vModel__": "F_ReasonType",
          "__config__": {
            "label": "借出事由",
            "showLabel": true,
            "tag": "el-select",
            "avueType": "select",
            "span": 24,
            "required": true,
            "saveField": "",
            "showField": "",
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 122,
            "dataType": "dataItem",
            "dataItem": "lend_reason",
            "fieldLength": "50",
            "bindTable": "apply_seal",
            "bindTableField": "F_ReasonType",
            "bindTableFieldType": "varchar"
          }
        }, {
          "tempType": "textarea",
          "__vModel__": "F_Remark",
          "__config__": {
            "label": "备注",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "textarea",
            "required": false,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 123,
            "fieldLength": 2000,
            "bindTable": "apply_seal",
            "bindTableField": "F_Remark",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "F_IsEffective",
          "__config__": {
            "label": "是否生效",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": false,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 124,
            "fieldLength": "10",
            "bindTable": "apply_seal",
            "bindTableField": "F_IsEffective",
            "bindTableFieldType": "varchar"
          }
        }, {
          "tempType": "textarea",
          "__vModel__": "field125dbe0",
          "__type__": "opinion",
          "__config__": {
            "label": "意见簿",
            "showLabel": true,
            "tag": "xjr-opinion-comonent",
            "defaultValue": null,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 125
          }
        }]
      };
      return config;
    },
  }
}

</script>
<style>
.el-table__empty-block {
  width: 100% !important;
}

.avue-form__row {
  padding: 0 !important;
}

#editorphone {
  width: 375px;
  margin: 0 auto;
  border: 1px solid #E4E7ED;
  padding: 0 7.5px;
  background: #f5f6fa;
  height: 700px;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 5px;
}

#editorphone .el-col {
  border-bottom: 1px solid #F2F2F2;
  background: #fff;
  margin-bottom: 0;
  padding: 0 15px 6px !important;
  width: 100%;
}

#editorphone .el-form-item__label {
  line-height: 20px
}

#editorphone .el-input-group .el-input__inner {
  background: #f5f6fa
}

#editorphone .el-input__inner {
  border: 0
}

#editorphone .el-input-group__append,
#editorphone .el-input-group__prepend {
  border: 0;
  background: #edeef2;
  color: #666;
}

#editorphone .el-input-group .el-input__prefix {
  left: 44px
}

#editorphone .el-input-group .el-input__suffix {
  right: 44px
}

#editorphone .el-form-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-flow: wrap;
}

#editorphone .el-form-item__label {
  float: none;
  min-width: 85px;
  width: auto !important;
  text-align: left;
  flex: auto;
}

#editorphone .tinymce .el-form-item__label {
  min-width: 100%;
}

#editorphone .el-form-item__content {
  margin-left: 0px !important;
  flex: auto;
  width: calc(100% - 95px);
}

#editorphone .avueFormNoLable .el-form-item__label,
#editorphone .avueFormNoLable .avue-crud__pagination {
  display: none;
}

#editorphone .avueFormNoLable .el-collapse-item__wrap,
#editorphone .avueFormNoLable .el-collapse {
  border-bottom: 0
}

#editorphone .avueFormNoLable .el-col {
  border-bottom: 0;
  padding-bottom: 0
}

#editorphone .el-form-item__content .el-button:first-child {
  margin-left: 90px;
}

</style>
